import Foundation

// 模拟Order类的generateOrderNumber方法
class TestOrder {
    static func generateOrderNumber(diningType: String, isGuest: Bool) -> String {
        // 获取当前序号（模拟UserDefaults）
        let currentNumber = 5200
        
        // 根据用餐类型和用户类型生成前缀
        let prefix: String
        switch diningType {
        case "dine_in":
            prefix = isGuest ? "CDI-" : "CMB-"
        case "takeaway":
            prefix = isGuest ? "CTO-" : "CMT-"
        case "delivery":
            prefix = isGuest ? "CDL-" : "CMD-"
        case "reservation":
            prefix = isGuest ? "CRS-" : "CMR-"
        default:
            prefix = "ORD-"
        }
        
        return "\(prefix)\(currentNumber)"
    }
}

// 测试所有订单类型
print("Testing iOS Order Number Generation:")
print("Dine-in Member:", TestOrder.generateOrderNumber(diningType: "dine_in", isGuest: false))
print("Dine-in Guest:", TestOrder.generateOrderNumber(diningType: "dine_in", isGuest: true))
print("Takeaway Member:", TestOrder.generateOrderNumber(diningType: "takeaway", isGuest: false))
print("Takeaway Guest:", TestOrder.generateOrderNumber(diningType: "takeaway", isGuest: true))
print("Delivery Member:", TestOrder.generateOrderNumber(diningType: "delivery", isGuest: false))
print("Delivery Guest:", TestOrder.generateOrderNumber(diningType: "delivery", isGuest: true))
print("Reservation Member:", TestOrder.generateOrderNumber(diningType: "reservation", isGuest: false))
print("Reservation Guest:", TestOrder.generateOrderNumber(diningType: "reservation", isGuest: true))